<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>AFC设备维修系统</title>
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/common.css" />
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/tag.css" />
		<script type="text/javascript">
	$(function() {
				var nav_timer = -1;
				$(".nav ul li").mouseover(function(){
					if ($(this).has("div.popupMenuClass").length > 0) {
						clearTimeout(nav_timer);
					}
					//如果当前存在a标签
					if($(this).has("div.popupMenuClass").length >0){
						$(this).children("div").show();
						$(this).children("div").attr("class", "m1");
						
					}
					
					var cssName = $(this).attr("class");
					if(cssName != "focus"){
						$(this).attr("class", "focus");
						$(this).children("a").css("color", "#fe7c0a");
					}
				});
				$(".nav ul li").mouseout(function(){
					if ($(this).has("div.popupMenuClass").length > 0) {
						var $this = $(this);
						nav_timer = setTimeout(function() {
							if($this.has("div.popupMenuClass").length >0){
								$this.children("div").hide();
							}

							var cssName = $this.attr("class");
							var col = $this.children("a").css("color");
							if(cssName == "focus" && col !="#000000"){
								$this.attr("class", "");
								$this.children("a").css("color", "#FFFFFF");
							}
						}, 100);
					} else {
						if($(this).has("div.popupMenuClass").length >0){
							$(this).children("div").hide();
						}
						
						var cssName = $(this).attr("class");
						var col = $(this).children("a").css("color");
						if(cssName == "focus" && col !="#000000"){
							$(this).attr("class", "");
							$(this).children("a").css("color", "#FFFFFF");
						}
					}
					
					/*
					if($(this).has("div.popupMenuClass").length >0){
						$(this).children("div").hide();
					}
					
					var cssName = $(this).attr("class");
					var col = $(this).children("a").css("color");
					if(cssName == "focus" && col !="#000000"){
						$(this).attr("class", "");
						$(this).children("a").css("color", "#FFFFFF");
					}
					*/
				});
				
				//头部点击高亮页面显示
				$(".nav ul li").click(function() {
					//获取导航信息 
					var item =$.trim($(this).attr("id"));
					
					//session 赋值哇  要了老命鸟  add gaoxuejiao
					var url = encodeURI(encodeURI('doNavSessionAtrr.action?navID=' + item));
					$.ajax( {
						url : url,
						type : "POST",
						cache : false,
						success : function(message) {
						}
					});
				});
				
				//二级标签过滤
				$(".nav ul").each(function(i){
					if(i==0){
						$(".nav ul li").each(function(i){
							//获取当前yiji标题id
							if(i==0){
								$(".nav ul li").attr("class", "");
								$(this).attr("class", "focus");
								$(this).children("a").css("color", "#000000");
							}
						});
					}
					//获取当前一级标题高亮id
					var inputValue =<%= session.getAttribute("liID") %>;
					//设置字符串
					var tempUL ="ul_"+$.trim(inputValue);
					
					//如果和session中一级标题id 相等
					if($(this).attr("id")==tempUL){
						var uid="#"+tempUL+" li";
						$(uid).each(function(j){
							if(j==0){
								$(uid).attr("class", "");
								$(uid).children("a").css("color", "#FFFFFF");
								$(this).attr("class", "focus");
								$(this).children("a").css("color", "#000000");
							}
							
							//设置头部加载高亮
							var inputValue =<%= session.getAttribute("navID") %>;
							//当前li id
							var liID = $(this).attr("id");
							if(null != inputValue && null != liID){
								if($.trim(inputValue) == $.trim(liID)){
									$(uid).attr("class", "");
									$(uid).children("a").css("color", "#FFFFFF");
									$(this).attr("class", "focus");
									$(this).children("a").css("color", "#000000");
								}
							}
						});
					}
				});

				$("div.popupMenuClass").hover(function() {
					$(this).css("background-color", "#FE7C0A");
				}, function() {
					$(this).css("background-color", "#ffffff");
				});
			});
        </script>
	</head>

	<body>
		<!-- 导航菜单 -->
		<div class="nav">
			<s:iterator value="#session.logUser.purviewList" id="clist"
				status="index">
				<!-- 判断当前是否是父节点  是否 循环显示二级菜单ul -->
				<s:if test="#clist.parentId ==-1 ">
					<!-- 默认加载第一个菜单 -->
					<s:if test="#index.first">
						<ul id="ul_${clist.id}" class="sddm" >
							<!-- 设置显示二级导航菜单 -->
							<s:iterator value="#session.logUser.purviewList" id="chList" status="status1">
								<!-- 如果当前节点等于上一个节点-->
								<s:if test="#chList.parentId ==#clist.id">
									<li id="${chList.id}" style="cursor: pointer;" >
										<a href="${chList.actionUrl}" style="display:block;width:150px;"> 
											${chList.actionName}
										</a>
										<div id="m1" style="position:absolute;width:130px;margin-left:8px;background-color:white;display: none;border: 2px solid;border-color: #FE7C0A;Z-INDEX: 100; ">
											<s:iterator value="#session.logUser.purviewList" id="dwList" status="state">
												<s:if test="#dwList.parentId ==#chList.id">
													<!-- <div><a href="${dwList.actionUrl}" style="color: black" onmouseover="menuMouseOver(this)" onmouseout="menuMouseOut(this)">${dwList.actionName }</a></div> -->
													<div class="popupMenuClass" style="padding-left:2px;text-align:left;color:black;font-weight:bold;" onclick="window.location.href='${dwList.actionUrl}'">${dwList.actionName }</div> 
												</s:if>
										 	</s:iterator> 
										</div> 
									</li>
								</s:if>
							</s:iterator>
						</ul>
					</s:if>
					<s:else>
						<ul id="ul_${clist.id}" style="display: none">
							<!-- 设置显示二级导航菜单 -->
							<s:iterator value="#session.logUser.purviewList" id="chList">
								<!-- 如果当前节点等于上一个节点-->
									<s:if test="#chList.parentId ==#clist.id">
									
										<li id="${chList.id}" style="cursor: pointer;" >
											<a href="${chList.actionUrl}" style="display:block;width:150px;">
												${chList.actionName}
											</a>
										</li>
									
								</s:if>
							</s:iterator>
						</ul>
					</s:else>
				</s:if>
			</s:iterator>
		</div>
	</body>
</html>
